<?php

//echo br(3); ###########################################################################################

	$TEMP->set_file(array('handle' => DIR_VIEW_DEAN . 'course.html'));
	
	$listCourses = $DSC->getListCourses($strAccDept);
	
	# LSITING
	if ( !empty($listCourses) ) {
		
		$TEMP->set_block('handle',  'courses', 'coursesRow');
		$bgcolor 	= LOOPING_F0F;
		$numCount 	= 1;
			
		foreach($listCourses as $listCoursesField => $listCoursesValue) {
			
			if ( $listCoursesValue['is_deleted'] == 'N') {
				$edButton = '<a href="?page=NewCourse&cid=' . $listCoursesValue['course_idPK'] . '&hash=' . hashrandom($listCoursesValue['course_idPK'] . $listCoursesValue['course_code']) . '"><img src="' . DIR_IMAGES . 'icon/pencil.png" border="0" title="Edit" class="cursor-pointer"/></a>
							 &nbsp;<img src="' . DIR_IMAGES . 'icon/preview.png" border="0" title="Preview" class="cursor-pointer" onclick="popupRequest(\'show\', \'SubjectPrintPreview\', \'' . $listCoursesValue['course_desc'] . ' (' . $listCoursesValue['course_code'] . ')\', \'550\', \'1000\', \'' . $listCoursesValue['course_idPK'] . '\');"/>
							 &nbsp;<img src="' . DIR_IMAGES . 'icon/sem.png" border="0" id="sem_img' . $listCoursesValue['course_idPK'] . '" onclick="linkNewPage(\'Semester&cid=' . $listCoursesValue['course_idPK'] . '\')"/>
							 <img src="' . DIR_IMAGES . 'icon/subj.png" border="0" id="subj_img' . $listCoursesValue['course_idPK'] . '" onclick="linkNewPage(\'Subject&cid=' . $listCoursesValue['course_idPK'] . '\')"/>
							';
				$delButton = '<div class="icon-button">
								<img src="' . DIR_IMAGES . 'icon/recyclebin.png" title="Delete" border="0" onclick="popupDelete(\'' . $listCoursesValue['course_idPK'] . '\', \'185\');" class="cursor-pointer"/>
								<div class="delete-button-right" id="delete_button_' . $listCoursesValue['course_idPK'] . '">
									<div class="delete-label">Delete this course?</div>
									<div class="delete-yes-no" onclick="deleteAccount(\'' . $listCoursesValue['course_idPK'] . '\', \'deleteCourse\');">Yes</div>
									<div class="delete-yes-no" onclick="popupDeleteHide(\'' . $listCoursesValue['course_idPK'] . '\');">No</div>
								</div>
							</div>';
			}
			else {
				$edButton = '&nbsp;&nbsp;<img src="' . DIR_IMAGES . 'icon/pencil_d.png" border="0" title="Edit"/>&nbsp;&nbsp;<img src="' . DIR_IMAGES . 'icon/recyclebin_d.png" title="Delete" border="0" />';
				$delButton = '<img src="' . DIR_IMAGES . 'icon/recyclebin_d.png" />';
			}
			
			$TEMP->set_var(array('course_id' 	=> $listCoursesValue['course_idPK'],
								 'course' 		=> $listCoursesValue['course_desc'],
								 'course_major'	=> (!empty($listCoursesValue['course_major'])) ? $listCoursesValue['course_major'] : '',
								 'course_code'	=> $listCoursesValue['course_code'],
								 'course_del'	=> $delButton,
								 'numbering'	=> $numCount,
								 'bgcolor'		=> $bgcolor,
								 'ed_button'	=> $edButton
								));
								
			$TEMP->parse('coursesRow', 'courses', true);
			$bgcolor = ($bgcolor == LOOPING_F0F) ? LOOPING_FFF : LOOPING_F0F;
			$numCount++;
		}
	}
	else {
			
		$TEMP->set_var(array('course_id' 	=> '',
							 'course' 		=> '',
							 'course_major'	=> '',
							 'course_code'	=> '',
							 'course_del'	=> '',
							 'numbering'	=> '',
							 'bgcolor'		=> '',
							 'ed_button'	=> '',
							));
	}
	
	$TEMP->set_var(array('search' 			=> $search,
						 'results'			=> "<strong>" . $listCountPersonalInformation . "</strong> results",
						 'urlPage'			=> $urlPage,
						 'dean_sub_menu'	=> $pageLib->deanSubMenu(DIR_IMAGES),
						 'dept_course'		=> $strAccCourse,
						));
?>